<?php
use think\facade\Route;

/** 接口路由 卡券-课程卡 - 后台*/
Route::group('admin/coupon/courseCard', function () {
    // 课程卡列表
    Route::get('list', 'index');
    // 创建课程卡
    Route::get('create', 'create');
    Route::post('create', 'create');
    // 编辑课程卡
    Route::get('<id>/edit', 'edit')->pattern(['id' => '\d+']);
    Route::put('<id>/edit', 'edit')->pattern(['id' => '\d+']);
    // 删除课程卡
    Route::delete('<id>/delete', 'delete')->pattern(['id' => '\d+']);
    // 课程卡领取以及使用详情
    Route::get('<coupon_id>/details', 'details')->pattern(['coupon_id' => '\d+']);
})->prefix('\app\course\service\coupon\admin\CourseCard@')->append(['online' => 1])->middleware(['adminRoute']);

Route::group('admin/coupon/courseCard', function () {
    // 获取课程列表--用于课程卡关联课程
    Route::get('courseList', 'getCourseList');
    // 获取课程分类
    Route::get('courseCategory/<pid>/list', 'getCourseCategory')->pattern(['pid' => '\d+']);
})->prefix('\app\course\service\base\admin\Course@')->middleware(['adminRoute']);

/** 线下卡券-课程卡 - 后台*/
Route::group('admin/coupon/offline/courseCard', function () {
    // 课程卡列表
    Route::get('list', 'index');
    // 创建课程卡
    Route::get('create', 'create');
    Route::post('create', 'create');
    // 编辑课程卡
    Route::get('<id>/edit', 'edit')->pattern(['id' => '\d+']);
    Route::put('<id>/edit', 'edit')->pattern(['id' => '\d+']);
    // 删除课程卡
    Route::delete('<id>/delete', 'delete')->pattern(['id' => '\d+']);
    // 课程卡领取以及使用详情
    Route::get('<coupon_id>/details', 'offlineDetatils')->pattern(['coupon_id' => '\d+']);
    // 导出
    Route::post('export', 'export');
})->prefix('\app\course\service\coupon\admin\CourseCard@')->append(['online' => 0])->middleware(['adminRoute']);

Route::group('admin/coupon/offline/courseCard', function () {
    // 获取课程列表--用于课程卡关联课程
    Route::get('courseList', 'getCourseList');
    // 获取课程分类
    Route::get('courseCategory/<pid>/list', 'getCourseCategory')->pattern(['pid' => '\d+']);
})->prefix('\app\course\service\base\admin\Course@')->middleware(['adminRoute']);
